# -*- coding: iso-8859-2 -*-

import re

class Message:
    '''
    Class representing a forum message
    Attributes:
    @param author
    @param email address
    @param subject
    @param text
    @param date
    @param signature
    @param requotationType
    '''      

    def __init__(self):
        self.author = ""
        self.address = ""
        self.subject = ""
        self.text = ""
        self.date = ""
        self.signature = ""
      
    def getAuthorNames(self):
        '''
        @return: list of words in name field
        '''
        result = []
        if re.search("\s+", self.author):
            result.extend(self.author.split())
        else:
            result.append(self.author)
        return result      
      
    def getAuthor(self):
        return self.author
    
    def setAuthor(self, author):
        if author != None:
            self.author = author
    
    def getSignature(self):
        return self.signature
    
    def setSignature(self, signature):
        if signature != None:
            self.signature = signature
    
    def getAddress(self):
        return self.address;
    
    def setAddress(self, address):
        if address != None:
            self.address = address;
    
    def getSubject(self):
        return self.subject
    
    def setSubject(self, subject):
        if subject != None:
            self.subject = subject
        
    def getText(self):
        return self.text
    
    def setText(self, text):
        if text != None:
            self.text = text.strip()
            
    def getDate(self):
        return self.date
    
    def setDate(self, date):
        if date != None:
            self.date = date
            
    def getRequotationType(self):
        return self.requotationType
    
    def setRequotationType(self, requotationType):
        self.requotationType = requotationType
        
    def printInfo(self, textLength = 100):
        '''Print short summary of the message
        @param textLength: length of the printed text message
        '''
        print "Author: " + self.author
        print "Date: " + str(self.date)
        print "Subject: " + self.subject
        print "Address: " + self.address
        print "Text:\n" + self.text[0:textLength]
        print "\n"   
        
if (__name__ == "__main__"):
    m = Message()
    m.setAuthor("jurek")
    print m.getAuthor()